<template>
  <div>
    <div style="width: 100%; height: 500px">
      <div style="width: 100%; height: 90px; margin-top: 7px" v-for="(it, i) in topMovie" :key="it">
        <el-card style="height: 90px">
          <div style="width: 15%; float: left" v-if="i == 0">
            <el-image style="width: 60px; height: 60px" :src="one" fit="fill"></el-image>
          </div>
          <div style="width: 15%; float: left" v-else-if="i == 1">
            <el-image style="width: 60px; height: 60px" :src="two" fit="fill"></el-image>
          </div>
          <div style="width: 15%; float: left" v-else-if="i == 2">
            <el-image style="width: 60px; height: 60px" :src="three" fit="fill"></el-image>
          </div>
          <div style="width: 15%; float: left" v-else>
            <span style="font-size: 50px; color: darkcyan"
              ><b>{{ i + 1 }}</b></span
            >
          </div>
          <div style="width: 30%; float: left" v-if="i == 0">
            <span style="font-size: larger; color: gold; float: left; margin-top: 10px"
              ><b>{{ it.mname }}</b></span
            >
          </div>
          <div style="width: 30%; float: left" v-else-if="i == 1">
            <span style="font-size: larger; color: gray; float: left; margin-top: 10px"
              ><b>{{ it.mname }}</b></span
            >
          </div>
          <div style="width: 30%; float: left" v-else-if="i == 2">
            <span style="font-size: larger; color: crimson; float: left; margin-top: 10px"
              ><b>{{ it.mname }}</b></span
            >
          </div>
          <div style="width: 30%; float: left" v-else>
            <span style="font-size: larger; color: black; float: left; margin-top: 10px"
              ><b>{{ it.mname }}</b></span
            >
          </div>
          <div style="width: 55%; float: left">
            <div style="width: 60%; float: left">
              <div style="text-align: left">
                <span style="font-size: small"><b>导演:</b>{{ it.director }}</span>
              </div>
              <div style="text-align: left">
                <span style="font-size: small"><b>主演:</b>{{ it.mrole }}</span>
              </div>
              <div style="text-align: left">
                <span style="font-size: small"><b>类型:</b>{{ it.mtype }}</span>
              </div>
            </div>
            <div style="float: left; width: 40%">
              <div>
                <div v-if="it.rate >= 4">
                  <span style="font-size: 40px; color: #67c23a"
                    ><b>{{ it.rate }}</b></span
                  ><br />
                </div>
                <div v-else-if="it.rate >= 3">
                  <span style="font-size: 40px; color: #409eff"
                    ><b>{{ it.rate }}</b></span
                  ><br />
                </div>
                <div v-else>
                  <span style="font-size: 40px"
                    ><b>{{ it.rate }}</b></span
                  ><br />
                </div>
                <el-rate v-model="it.rate" disabled text-color="#ff9900" v-if="it.rate <= 5">
                </el-rate>
                <el-rate v-model="val_5" disabled text-color="#ff9900" v-else> </el-rate>
              </div>
            </div>
          </div>
        </el-card>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import axios from 'axios';
let topMovie = ref();
const one = require('../../assets/img/no1.webp');
const two = require('../../assets/img/no2.webp');
const three = require('../../assets/img/no3.webp');
const val_5 = 5;
onMounted(() => {
  axios.get('/api/movie/getTop5Movie').then(res => {
    topMovie.value = res.data;
  });
});
</script>
